#include "anaglyph.h"

Anaglyph::Anaglyph(unsigned int width, unsigned int height, unsigned int _level, bool antialiasing) :
    RayTracer(width,height,_level,antialiasing), mask1(1.0,0.0,0.0), mask2(0.0,1.0,1.0), eyeDistance(1e-2)
{

}

Anaglyph::~Anaglyph()
{

}

void Anaglyph::setAnaglyphSettings(const Color &_mask1, const Color &_mask2, const double &_eyeDistance)
{
    mask1       = _mask1;
    mask2       = _mask2;
    eyeDistance = _eyeDistance;
}


void Anaglyph::render(const std::string &outFile) const
{
    ((RayTracer*)this)->render(outFile,mask1,-(eyeDistance/2.0));
    ((RayTracer*)this)->render(outFile,mask2, (eyeDistance/2.0));
}


double Anaglyph::getAutoFocus() const
{
    return (camera.getViewVector().norm()/30.0);
}

